package cn.cjp.m3d22;

public class Outer {

    //外部类成员变量
    int one = 1;

    public class Inner{

        //内部类成员变量
        int one = 2;

        public void methodinner() {
            int one = 3;
            //内部类局部变量
            System.out.println(one);
            System.out.println(this.one);
            System.out.println(Outer.this.one);
        }
    }

    public void merthodouter(){
        //内部类访问所在方法的局部变量时，默认该变量加了final,不手动加也可以
        int num1 = 20;
        //num1 = 22;   不可以

        //局部内部类
        class Inner{
            int num =10;
            public void methodinner1(){
                System.out.println(num);
                System.out.println(num1);
            }
        }

        //只能用过此方法来调用这个局部内部类
        Inner inner = new Inner();
        inner.methodinner1();
    }
}
